package cn.vcjf.weapp.api.user.entity;

import cn.vcjf.weapp.common.web.JsonDateTypeConvert;
import cn.vcjf.weapp.common.web.PageModel;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.math.BigDecimal;
import java.util.Date;

/**
 * <p>
    * 
    * </p>
 *
 * @author zhengzihang
 * @since 2018-09-25
 */
@TableName("vc_user_discount")
public class UserDiscount extends PageModel<UserDiscount> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer userId;

    /**
     * 优惠券ID
     */
    private Integer discountId;

    /**
     * 使用状态(0,未使用,1,已使用,3过期)
     */
    private Integer useStatus;
    /**
     * 优惠券编号
     */
    private Long discountNo;

    private String discountName;

    /**
     * 优惠券类型
     */
    private Integer discountType;

    /**
     * 优惠券金额
     */
    private BigDecimal price;

    /**
     * 最低使用金额（满多少才能用）
     */
    private BigDecimal minUsePrice;

    /**
     * 使用截止时间
     */
    private Date useEndTime;
/**********************************************************************/
    /**
     * 使用类型
     */
    @TableField(exist = false)
    private String useType;

    /**
     *商品分类id(过滤参数)
     */
    @TableField(exist = false)
    private String goodsTypeIds;
    /**
     *商品id(过滤参数)
     */
    @TableField(exist = false)
    private Integer goodsId;

    @JsonIgnore
    public String getGoodsTypeIds() {
        return goodsTypeIds;
    }

    public void setGoodsTypeIds(String goodsTypeIds) {
        this.goodsTypeIds = goodsTypeIds;
    }
    @JsonIgnore
    public Integer getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Integer goodsId) {
        this.goodsId = goodsId;
    }

    public String getUseType() {
        return useType;
    }

    public void setUseType(String useType) {
        this.useType = useType;
    }

    public Long getDiscountNo() {
        return discountNo;
    }

    public void setDiscountNo(Long discountNo) {
        this.discountNo = discountNo;
    }

    public String getDiscountName() {
        return discountName;
    }

    public void setDiscountName(String discountName) {
        this.discountName = discountName;
    }

    public Integer getDiscountType() {
        return discountType;
    }

    public void setDiscountType(Integer discountType) {
        this.discountType = discountType;
    }

    public BigDecimal getPrice() {
        return price;
    }

    public void setPrice(BigDecimal price) {
        this.price = price;
    }

    public BigDecimal getMinUsePrice() {
        return minUsePrice;
    }

    public void setMinUsePrice(BigDecimal minUsePrice) {
        this.minUsePrice = minUsePrice;
    }
    @JsonSerialize(using = JsonDateTypeConvert.class)
    public Date getUseEndTime() {
        return useEndTime;
    }

    public void setUseEndTime(Date useEndTime) {
        this.useEndTime = useEndTime;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }
    public Integer getDiscountId() {
        return discountId;
    }

    public void setDiscountId(Integer discountId) {
        this.discountId = discountId;
    }
    public Integer getUseStatus() {
        return useStatus;
    }

    public void setUseStatus(Integer useStatus) {
        this.useStatus = useStatus;
    }

    /**
     * 领取日期
     * @return
     */
    @JsonSerialize(using = JsonDateTypeConvert.class)
    public Date getGetDate() {
        return createTime;
    }

    @Override
    public void preInsert(){
        super.preInsert();
    }
    @Override
    public void preUpdate(){
        super.preInsert();
    }
    @Override
    public String toString() {
        return "UserDiscount{" +
        "id=" + id +
        ", userId=" + userId +
        ", discountId=" + discountId +
        ", useStatus=" + useStatus +
        ", createUser=" + createUser +
        ", createTime=" + createTime +
        ", updateUser=" + updateUser +
        ", updateTime=" + updateTime +
        ", deleteFlag=" + deleteFlag +
        ", sysUserId=" + sysUserId +
        "}";
    }
}
